package so.sao.code.service.infrastructure.enums;

import so.sao.top.core.util.enums.NamedEnumEntity;

public enum ActivationMethod implements NamedEnumEntity<Integer> {
    /**
     * 现在激活
     */
    Now(1, "现在激活"),
    /**
     * 延时激活
     */
    Delay(2, "延时激活"),
    /**
     * 自定义激活时间点
     */
    Custom(3, "在这个时间点激活"),
    /**
     * 用户扫码激活
     */
    Scan(4, "用户扫码激活"),
    /**
     * 指定某个动作点后激活
     */
    Appoint(5, "在{0}后激活"),
    /**
	 * 供应链激活
	 */
    SupplyChina(6, "供应链激活");

	private Integer id;

    private String name;

	private ActivationMethod(Integer id, String name) {
		this.id = id;
        this.name = name;
    }

    @Override
    public Integer getValue() {
		return id;
    }

    @Override
    public String getName() {
        return name;
    }

	public static ActivationMethod fromValue(Integer id) {
		switch (id) {
            case 1:
                return Now;
            case 2:
                return Delay;
            case 3:
                return Custom;
            case 4:
                return Scan;
            case 5:
                return Appoint;
            case 6:
                return SupplyChina;
            default:
			throw new IllegalArgumentException("Value [" + id + "] not support!");
        }
    }
}
